<template>
  <el-container class="container">
    <!-- 头部 -->
    <el-header class="header">
      <el-row>
        <el-col :span="4">
          <div class="grid-content bg-purple">
            <img src="@/assets/img/logo.jpg" alt="无法显示图片" class="icon" />
          </div>
        </el-col>
        <el-col :span="18" class="middle">
          <div class="grid-content bg-purple-light">
            <h3>启迪汽车销售系统</h3>
          </div>
        </el-col>
        <el-col :span="2">
          <div class="grid-content bg-purple">
            <a href="" class="loginout" @click.prevent="handleSignout()"
              >退出</a
            >
          </div>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="200px" class="aside">
        <el-menu
          class="el-menu-vertical-demo"
          :unique-opened="true"
          :router="true"
        >
          <el-submenu index="home">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>销售管理</span>
            </template>
            <el-menu-item index="sells">
              <i class="el-icon-menu"></i>
              <span>销售单查询</span>
            </el-menu-item>
            <!-- <el-menu-item index="sells">
              <i class="el-icon-menu"></i>
              <span>新建销售单</span>
            </el-menu-item> -->
            <el-menu-item index="sells">
              <i class="el-icon-menu"></i>
              <span>试驾预约</span>
            </el-menu-item>
            <el-menu-item index="sells">
              <i class="el-icon-menu"></i>
              <span>试驾查询</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>采购管理</span>
            </template>
            <el-menu-item index="buy">
              <i class="el-icon-menu"></i>
              <span>采购单列表</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>车辆管理</span>
            </template>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>供应商管理</span>
            </el-menu-item>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>品牌管理</span>
            </el-menu-item>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>车辆查询</span>
            </el-menu-item>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>供应商录入</span>
            </el-menu-item>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>品牌录入</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>仓库管理</span>
            </template>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>入库管理 </span>
            </el-menu-item>
            <el-menu-item index="outboard">
              <i class="el-icon-menu"></i>
              <span>出库管理</span>
            </el-menu-item>
             <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>库存查询</span>
            </el-menu-item>
             <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>补货提醒</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>客户管理</span>
            </template>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>客户查询</span>
            </el-menu-item>
            <el-menu-item index="1-1">
              <i class="el-icon-menu"></i>
              <span>客户录入</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="6">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>系统管理</span>
            </template>
            <el-menu-item index="users">
              <i class="el-icon-menu"></i>
              <span>员工查询</span>
            </el-menu-item>
             <el-menu-item index="users">
              <i class="el-icon-menu"></i>
              <span>员工录入</span>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!-- 主要部分 -->
      <el-main class="main">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
export default {
  name: "home",
  beforeCreate() {
    const token = localStorage.getItem("token");
    if (!token) {
      this.$router.push({ name: "login" });
    }
  },
  methods: {
    handleSignout() {
      localStorage.clear();
      this.$message.success("退出成功");
      this.$router.push({ name: "login" });
    },
  },
};
</script>
<style scoped>
.container {
  height: 100%;
}
.header {
  background-color: #b3c0d1;
}
.aside {
  background-color: #d3dce6;
}
.main {
  background-color: #e9eef3;
}
.icon {
  width: 160px;
  height: 60px;
}
.middle {
  text-align: center;
  color: #fff;
}

.loginout {
  line-height: 60px;
  text-decoration: none;
  color: #fff;
}
</style>